﻿
<%namespace YouHP.Model%>
<%namespace YouHP.Utility%>

<%template _Header%>

<script type="text/javascript">
var query = location.href.substring(location.href.indexOf("?")); 

function loadActionList()
{
  
  var aurl = "/Pages/alpha/Ajax/ActionListAjax.aspx"+query+"&page=1";
  var myAjax=new Ajax(aurl,
  {
     method:'get',
     onComplete:function()
     {
      var html=this.response.text;
      _$("ActionList").innerHTML=html;
      _$("sendaction").style.display = 'block';
     }
   }
   );
   myAjax.request();
  
  
}

function ViewActionPage(pageindex)
{
  
  var aurl = "/Pages/alpha/Ajax/ActionListAjax.aspx"+query+"&page="+pageindex;
  var myAjax=new Ajax(aurl,
  {
     method:'get',
     onComplete:function()
     {
      var html=this.response.text;
      _$("ActionList").innerHTML=html;
      }
   }
   );
   myAjax.request();
  
  
} 
 
function ActionDelete(id)
{
  
  var aurl = "/Pages/alpha/Ajax/ActionDeleteAjax.aspx"+query+"&id="+id;
  var myAjax=new Ajax(aurl,
  {
     method:'get',
     onComplete:function()
     {
      var html=this.response.text;
      _$("ActionList").innerHTML=html;
      }
   }
   );
   myAjax.request();
  
  
} 


function ActionAdd()
{

  var msg = _$("msg").value;
  if(msg == _$("msg").defaultValue)  msg="";
  
  var actiontype = 0;
  var form = _$('feedback');
  for(var i = 0;i < form.elements.length;i++)
  {
      var e = form.elements[i];
      if(e.name == "hugtype")
      {
         if(e.checked == true)
         {
             actiontype = e.value;
             break;
         }
      }
   }   

    if(msg.length > 300 ) 
    {
        alert("陈述内容不能超过300个字！");
        return;
    }
    _$("submitbutton").value = "正在处理...";
    var aurl = "/Pages/alpha/Ajax/ActionAddAjax.aspx"+query+"&msg="+msg.escUrl()+"&actiontype="+actiontype;
    var myAjax=new Ajax(aurl,
    {
         method:'post',
         onComplete:function()
         {
              
                   var html=this.response.text;    
                   _$("ActionList").innerHTML=html;
                   _$("msg").value=""; 
                   _$("submitbutton").value = "马上发表";

          }
    }
   );
   myAjax.request();
  
  
}

function ActionReplyAdd(id,toUserId)
{

          var replycontent = _$("replycontent"+id).value;
          if(replycontent == _$("replycontent"+id).defaultValue)  replycontent="";
          
          var actiontype = 0;
          var form = _$('huglist'+id);
          for(var i = 0;i < form.elements.length;i++)
          {
              var e = form.elements[i];
              if(e.name == "r_hugtype")
              {
                 if(e.checked == true)
                 {
                     actiontype = e.value;
                     break;
                 }
              }
           }   

            if(replycontent.length > 300 ) 
            {
                alert("陈述内容不能超过300个字！");
                return;
            }
      
      var aurl = "/Pages/alpha/Ajax/ActionSendAjax.aspx"+query+"&msg="+replycontent.escUrl()+"&actiontype="+actiontype+"&toUserId="+toUserId;
      var myAjax=new Ajax(aurl,
      {
         method:'get',
         onComplete:function()
         {
           alert(this.response.text);
           _$('replycontent'+id).value = "";
           _$('replybox'+id).style.display = 'none';
          }
       }
       );
       myAjax.request();


}

function replyadd(id)
{

      _$('replybox'+id).style.display = 'block';
}
function replycancell(id)
{

      _$('replybox'+id).style.display = 'none';
}

loadActionList();
</script>

<div class="layout2-cols2">
	
     <div class="col1">
		<%template _ProfileMenu%>
	</div>
    
<div class="col2">
	    
	 <div class="box">
	    	    <%template _ProfileHeader%>

	       <div id="ActionList"  style="margin-top:10px;">
	            <div style="padding:20px 50px;">
                <%csharp%> TempUrl = "/images/indicator_medium.gif";<%/csharp%>
                <img src="{this.GetResource(TempUrl)}" /><b>正在加载互动……</b>

                </div>
 
	        </div>
	    

	    </div>

<%if IsPost%>
     <%template _msgbox%>
<%else%> 	  
	  
<div id="sendaction" style="display:none;">
	        
 <%csharp%>TempUrl = ModuleCtrl.Header4("Actionpost","给"+ProfileData.UserName+"一个互动",false,false); <%/csharp%>
{TempUrl}
	        <div class="content">
 <%csharp%>if(UserData.Id > 0){<%/csharp%>
	               <form id="feedback" name="feedback">
	                <div id="plshow">
	                    <p>&nbsp;&nbsp;</p>
                        <table width="95%">                            
                            <tr>
                                <%csharp%> for (int i=0; i < Constants.HugTypeCount; i ++) { <%/csharp%>
                                <td width="80"><table>
                                    <tr height="35"><td align="center"><img src="{Utils.GetHugUrl(i)}"  /></td></tr>
                                    <tr height="20"><td align="center"><span>{Utils.GetHugText(i)}</span></td></tr>
                                    <tr height="20"><td align="center">
                                        <input type="radio" class="radio" id="hugtype{i}" name="hugtype" value="{i}" />
                                    </td></tr>
                                </table></td>
                                <%csharp%> } <%/csharp%>
                               <td>&nbsp;&nbsp;</td>
                            </tr>
                        </table>
                        <script type="text/javascript">
                            _$('hugtype0').checked = true;
                        </script>
	                    
	                    <div class="bor"> 
                            <textarea name="msg" cols="100" rows="6" id="msg" class="rev_textarea" style="color:rgb(170, 170, 170);" onfocus="OnEnter(this);" onblur="OnExit(this);">随便说两句....</textarea>
                        </div>
                        &nbsp;&nbsp;撒播爱的种子
                        &nbsp;&nbsp;&nbsp;&nbsp;<input name="sb" id="submitbutton" type="button" value="马上发表" class="" onclick="if({UserData.Id}=={ProfileData.Id}) alert('不能给自己发互动！');else ActionAdd();" />
                    </div>
                 </form>
           <%csharp%>}else{<%/csharp%>
           
           <%csharp%>TempUrl = "/User/Login.aspx"; <%/csharp%>
          <h1>请在<a href="{this.GetUrl(TempUrl)}"><b style="text-decoration:underline; color:Red;">登录</b></a>后给对方发互动</h1>

	       <%csharp%>}<%/csharp%>
            </div>
 <%csharp%>TempUrl = ModuleCtrl.Footer("Actionpost"); <%/csharp%>
 {TempUrl}
 
</div>


<%/if%>
 

</div>
</div>

<%template _footer%>		
